import java.util.Scanner;

class PasswordInputSystem {
    private static final int MAX_ATTEMPTS = 3;
    private static final int LOCK_TIME_SECONDS = 120;
    private int attempts;
    private long lockStartTime;
    private boolean locked;
    private String correctPassword = "123456"; // 假设正确密码是123456

    public PasswordInputSystem() {
        this.attempts = 0;
        this.locked = false;
    }

    public void waitForInput() {
        if (!locked) {
            System.out.println("请输入密码：");
        }
    }

    public void readKeyInput() {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        if (input.length() == correctPassword.length()) {
            verifyPassword(input);
        } else {
            System.out.println("密码长度不正确");
        }
    }

    private void verifyPassword(String input) {
        if (input.equals(correctPassword)) {
            System.out.println("密码正确，进入系统功能选择");
            // 这里可以添加进入系统功能选择的代码
        } else {
            attempts++;
            if (attempts >= MAX_ATTEMPTS) {
                lockStartTime = System.currentTimeMillis();
                locked = true;
                System.out.println("密码错误次数过多，系统已锁定，请等待" + LOCK_TIME_SECONDS + "秒");
            } else {
                System.out.println("密码错误，请重新输入");
            }
        }
    }

    public void checkLockStatus() {
        if (locked) {
            long currentTime = System.currentTimeMillis();
            if (currentTime - lockStartTime >= LOCK_TIME_SECONDS * 1000) {
                locked = false;
                attempts = 0;
                System.out.println("系统已解锁，请重新输入密码");
            }
        }
    }
}

public class Passwords {
    public static void main(String[] args) {
        PasswordInputSystem system = new PasswordInputSystem();
        while (true) {
            system.checkLockStatus();
            system.waitForInput();
            system.readKeyInput();
        }
    }
}